package models

import "strconv"

type User struct {
	ID
	Name     string `json:"name" gorm:"size:30;not null;comment:用户名称"`
	Mobile   string `json:"mobile" gorm:"size:24;not null;index;comment:用户手机号"`
	Status   uint   `json:"status" gorm:"not null;default:1;comment:用户状态"`
	Email    string `json:"email" gorm:"default:null;comment:email"`
	Realname string `json:"realname" gorm:"default:null;comment:姓名"`
	Password string `json:"-" gorm:"not null;default:'';comment:用户密码"`

	Timestamps
	SoftDeletes
}

func (user User) GetUid() string {
	return strconv.Itoa(int(user.ID.ID))
}

type UserList struct {
	ID       int    `json:"id" `
	Name     string `json:"name" `
	RealName string `json:"real_name" `
	Email    string `json:"email" `
	Status   uint   `json:"status" `
	RoleName string `json:"role_name" `
}
